package bb.lanxing.model.json;

import android.os.Parcel;
import android.os.Parcelable;
import bb.lanxing.manager.RemoteSharedPreference;
import bb.lanxing.util.SectionParseUtil;
import java.io.Serializable;

public class UserSettings implements Serializable, Parcelable {
    public static final Parcelable.Creator<UserSettings> CREATOR = new Parcelable.Creator<UserSettings>() {
        @Override
        public UserSettings createFromParcel(Parcel parcel) {
            return new UserSettings(parcel);
        }

        @Override
        public UserSettings[] newArray(int i) {
            return new UserSettings[i];
        }
    };
    private float ftp;
    private float lthr;
    private String segmentsCa;
    private String segmentsHr;

    @Override
    public int describeContents() {
        return 0;
    }

    public UserSettings() {
    }

    protected UserSettings(Parcel parcel) {
        this.segmentsHr = parcel.readString();
        this.segmentsCa = parcel.readString();
        this.ftp = parcel.readFloat();
        this.lthr = parcel.readFloat();
    }

    public String getSegmentsHr() {
        return this.segmentsHr;
    }

    public void setSegmentsHr(String str) {
        this.segmentsHr = str;
    }

    public String getSegmentsCa() {
        return this.segmentsCa;
    }

    public void setSegmentsCa(String str) {
        this.segmentsCa = str;
    }

    public float getFtp() {
        return this.ftp;
    }

    public void setFtp(float f) {
        this.ftp = f;
        RemoteSharedPreference.getInstance().setPowerMax((int) f);
    }

    public float getLthr() {
        return this.lthr;
    }

    public void setLthr(float f) {
        this.lthr = f;
    }

    public int[] getHeartrateSections() {
        return SectionParseUtil.parse(this.segmentsHr, 7);
    }

    public int[] getCadenceSections() {
        return SectionParseUtil.parse(this.segmentsCa, 4);
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(this.segmentsHr);
        parcel.writeString(this.segmentsCa);
        parcel.writeFloat(this.ftp);
        parcel.writeFloat(this.lthr);
    }
}
